package com.archetypus.projectschedule.common.data;

import com.archetypus.projectschedule.common.Configuration;
import com.archetypus.projectschedule.common.data.activities.ActivityDAO;
import com.archetypus.projectschedule.common.data.involvements.InvolvementDAO;
import com.archetypus.projectschedule.common.data.people.PersonDAO;
import com.archetypus.projectschedule.common.data.projects.ProjectDAO;

public abstract class DAOFactory {

	private static String databaseFactory;
	private static DAOFactory factory;
	
	public static DAOFactory getDAOFactory() {
		if (databaseFactory.equals("ORACLE")) {
			factory = new OracleDAOFactory();
		} else if (databaseFactory.equals("SQL_SERVER")) {
			factory = new SQLServerDAOFactory();
		}else if (databaseFactory.equals("MYSQL")){
			factory = new MySqlDAOFactory();
		} else {
			factory = null;
		}
		
		return factory;
	}

	public static void init(){
		databaseFactory = Configuration.getInstance().get("databaseFactory");
	}

	public abstract ActivityDAO getActivityDAO();

	public abstract InvolvementDAO getInvolvementDAO();

	public abstract PersonDAO getPersonDAO();

	public abstract ProjectDAO getProjectDAO();
}
